package com.dmgis.hndz.service.impl;

import com.dmgis.hndz.mapper.Qxbc01aMapper;
import com.dmgis.hndz.pojo.Qxbc01a;
import com.dmgis.hndz.service.Qxbc01aService;
import com.github.pagehelper.PageHelper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;


@Service
public class Qxbc01aServiceImpl implements Qxbc01aService {

    @Autowired
    private Qxbc01aMapper qxbc01aMapper;

    /**
     * 查询 分页查询
     *
     * @author pengdongdong
     * @date 2024/11/11
     **/
    public List<Qxbc01a> selectQxbc01aList(Integer pageNum, Integer pageSize,
                                           String name, String adminCode) {
        if (pageNum != null && pageSize != null) {
            PageHelper.startPage(pageNum, pageSize);
        }
        String isCounty = "";
        // 省级查询全部
        if (adminCode.endsWith("0000")) {
            name = "";
        // 查询市级
        } else if (adminCode.endsWith("00")) {
            isCounty = "1";
        }
        return qxbc01aMapper.selectQxbc01aList(name, isCounty);
    }

    @Override
    public List<Qxbc01a> past24HoursList(String name, String adminCode) {
        String isCounty = "";
        // 省级查询全部
        if (adminCode.endsWith("0000")) {
            name = "";
            // 查询市级
        } else if (adminCode.endsWith("00")) {
            isCounty = "1";
        }
        return qxbc01aMapper.past24HoursList(name, isCounty);
    }

}
